package org.snackframework.core;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.snackframework.annotation.ScreenHandler;

/**
 * 
 * @author allen Jun 24, 2010
 *
 */
public abstract class ScreenTemplate
{
	/**
	 * //TODO
	 * @ScreenHandler 指定模板对应的处理函数，避免在代码中直接写死，暂时相关代码中还没有实现，主要问题在接口中的annotation
	 * 没法继承下来   
	 */
	@ScreenHandler
	public void execute(HttpServletRequest req,HttpServletResponse resp, ModelMap context)
	{
		preHandle(req,resp,context);
		
		handle(req,resp,context);
		
		postHandle(req,resp,context);
	}
	
	public abstract void handle(HttpServletRequest req,HttpServletResponse resp,ModelMap context);
	
	public void preHandle(HttpServletRequest req,HttpServletResponse resp,ModelMap context){}
	
	public void postHandle(HttpServletRequest req,HttpServletResponse resp,ModelMap context){}
}
